package bestTeam.WalkieDoggie.client;

import java.util.Comparator;
import java.util.Date;

import bestTeam.WalkieDoggie.client.Serializables.UserRequest;

public class dateComperator implements Comparator<UserRequest>{

	private int order=1;
	
	public dateComperator(int ord){
		order=ord;
	}
	
	@Override
	public int compare(UserRequest o1, UserRequest o2) {

		Date d1=o1.getDate();
		Date d2=o2.getDate();
		int res =  d1.compareTo(d2) * order;
		timeFrameComperator t;
		if(res!=0)
			return res;
		else{
			t=new timeFrameComperator(order);
			return t.compare(o1, o2);
		}
	}

}
